import random
import string
import hashlib

def generate_random_filename(prefix='', extension=''):
    """
    Generates a random filename with the given prefix and extension.

    Args:
        prefix (str): A string to prefix the filename with. Default is an empty string.
        extension (str): A string to use as the filename extension. Default is an empty string.

    Returns:
        str: A random filename with the specified prefix and extension.
    """
    random_chars = ''.join(random.choices(string.ascii_letters + string.digits, k=64))
    filename = f"{prefix}{random_chars}{extension}"
    return filename

def generate_random_string(length = 64):
    """生成指定长度的随机字符串"""
    letters_and_digits = string.ascii_letters + string.digits  # 包含字母和数字的字符集
    return ''.join(random.choice(letters_and_digits) for _ in range(length))

def str_to_hash(s):
    encoded_str = s.encode('utf-8')
    hash_obj = hashlib.sha256(encoded_str)
    hex_digest = hash_obj.hexdigest()
    hash_code = int(hex_digest, 16)
    return hash_code